﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Tokenizer.Symbols.SymbolBase`1
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using Microsoft.Internal.Web.Utils;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Web.Razor.Parser.SyntaxTree;
using System.Web.Razor.Text;

namespace System.Web.Razor.Tokenizer.Symbols
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents a new instance of symbols.</summary>
  /// <typeparam name="TType">The generic type.</typeparam>
  public abstract class SymbolBase<TType> : ISymbol
  {
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" /> class.</summary>
    /// <param name="start">The source location.</param>
    /// <param name="content">The content value.</param>
    /// <param name="type">The type.</param>
    /// <param name="errors">The razor error.</param>
    protected SymbolBase(
      SourceLocation start,
      string content,
      TType type,
      IEnumerable<RazorError> errors)
    {
      if (content == null)
        throw new ArgumentNullException(nameof (content));
      if ((object) type == null)
        throw new ArgumentNullException(nameof (type));
      this.Start = start;
      this.Content = content;
      this.Type = type;
      this.Errors = errors;
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the starting point of the source location.</summary>
    /// <returns>The starting point of the source location.</returns>
    public SourceLocation Start { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the content of a <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" />.</summary>
    /// <returns>The content of a <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" />.</returns>
    public string Content { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the razor error.</summary>
    /// <returns>The razor error.</returns>
    public IEnumerable<RazorError> Errors { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets a Type that inherits from the base Type.</summary>
    /// <returns>A Type that inherits from the base Type.</returns>
    public TType Type { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Determines whether the specified Object is equal to the current Object.</summary>
    /// <returns>true if the specified Object is equal to the current Object; otherwise, false.</returns>
    /// <param name="obj">The object.</param>
    public override bool Equals(object obj) => obj is SymbolBase<TType> symbolBase && (this.Start.Equals(symbolBase.Start) && string.Equals(this.Content, symbolBase.Content, StringComparison.Ordinal)) && this.Type.Equals((object) symbolBase.Type);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Retrieves a hash code based on the current <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" /> object.</summary>
    /// <returns>A hash of the current <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" /> object.</returns>
    public override int GetHashCode() => HashCodeCombiner.Start().Add((object) this.Start).Add((IEnumerable) this.Content).Add((object) this.Type).CombinedHash;

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Generates a string representation of the current <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" /> object.</summary>
    /// <returns>A string representation of the current <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolBase`1" /> object.</returns>
    public override string ToString() => string.Format((IFormatProvider) CultureInfo.InvariantCulture, "{0} {1} - [{2}]", (object) this.Start, (object) this.Type, (object) this.Content);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Starts the time’s offset for the source location.</summary>
    /// <param name="documentStart">The document start.</param>
    public void OffsetStart(SourceLocation documentStart) => this.Start = documentStart + this.Start;

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Changes the start of the machine.</summary>
    /// <param name="newStart">The new start.</param>
    public void ChangeStart(SourceLocation newStart) => this.Start = newStart;
  }
}
